package top.goldenyear.porpoise.common.core.util.context;

import com.alibaba.ttl.TransmittableThreadLocal;
import top.goldenyear.porpoise.system.account.model.Account;

/**
 * @author airhead
 */
public class ContextUtils {
  private static final ThreadLocal<Account> ACCOUNT_THREAD_LOCAL = new TransmittableThreadLocal<>();

  public static Account getAccount() {
    return ACCOUNT_THREAD_LOCAL.get();
  }

  public static void setAccount(Account account) {
    ACCOUNT_THREAD_LOCAL.set(account);
  }

  public static void clearAccount() {
    ACCOUNT_THREAD_LOCAL.remove();
  }
}
